package sj.sj3.service.impl;

import sj.sj3.dao.UserDao;
import sj.sj3.dao.impl.UserDaoImpl;
import sj.sj3.pojo.User;
import sj.sj3.service.UserService;

/**
 * 用户业务类，实现对User功能的业务管理
 */
public class UserServiceImpl implements UserService {

    /**
     * 声明接口类型的引用，和具体实现类解耦合
     */
    private UserDao dao;

    public UserDao getDao() {
        return dao;
    }

    public void setDao(UserDao dao) {
        this.dao = dao;
    }

    //无参构造
    public UserServiceImpl(){}
    //用于为dao属性赋值的构造方法
    public UserServiceImpl(UserDao dao){
        this.dao = dao;
    }

    /**
     * 保存用户信息
     * @param user
     */
    @Override
    public void save(User user) {
        //保存信息
        dao.save(user);
    }

}
